package com.tiduyun.data.exchange;

import org.apache.catalina.connector.Connector;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.embedded.tomcat.ConfigurableTomcatWebServerFactory;
import org.springframework.boot.web.embedded.tomcat.TomcatConnectorCustomizer;
import org.springframework.boot.web.server.WebServerFactoryCustomizer;
import org.springframework.context.annotation.Bean;

@SpringBootApplication
public class DataExchangeServerApplication {

    @Bean
    public WebServerFactoryCustomizer<ConfigurableTomcatWebServerFactory> MyTomcatWebServerCustomizer() {
        return new WebServerFactoryCustomizer<ConfigurableTomcatWebServerFactory>() {
            @Override
            public void customize(ConfigurableTomcatWebServerFactory factory) {
                TomcatConnectorCustomizer cc = new TomcatConnectorCustomizer() {

                    @Override
                    public void customize(Connector connector) {
                        // 设置tomcat不自动解析body
                        connector.setParseBodyMethods(null);
                    }

                };
                factory.addConnectorCustomizers(cc);
            }
        };
    }

    public static void main(String[] args) {
        SpringApplication.run(DataExchangeServerApplication.class, args);
    }
}
